import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;


@SuppressWarnings("serial")
public class ContainerGraph extends JPanel {

	private static int maxWeight;
	private int currentWeight = 500; //TODO
	
	@SuppressWarnings("static-access")
	public ContainerGraph(int maxWeight) {
		super(true);
		this.maxWeight = maxWeight;
	}
	
	public void setCurrentWeight(int currentWeight) {
		this.currentWeight = currentWeight;
		repaint();
	}
	
	private int getScaleY() {
		return getHeight() - getScaleHeight();
	}
	
	private int getScaleHeight() {
		return getHeight()*currentWeight/maxWeight;
	}
	
	public void paint(Graphics g) {
		g.fillRect(0, 0, getWidth(), getHeight());
		g.setColor(Color.green);
		g.fillRect(0, getScaleY(), this.getWidth(), getScaleHeight());
	}
	
}
